package com.gryffonx.Interfaces.NPC;

import com.gryffonx.Interfaces.timeline.TimelineGenerator;
import com.gryffonx.utils.StringUtils;

import javax.swing.*;
import java.awt.*;

/**
 * **************************************************************************
 * Application:
 * Author: Erik Stell
 * Date: Feb 22, 2005
 * Time: 9:37:09 AM
 * Process:
 * **************************************************************************
 */
public class NPCEdit extends JFrame {
    private final NPCEditBinding thisPanel;

    /**
     * Constrcutor for an empty frame
     *
     * @param title
     * @throws HeadlessException
     */
    public NPCEdit(String title) throws HeadlessException {
        super(title);
        //setResizable(false);
        thisPanel = new NPCEditBinding();
        setLocation(((Toolkit.getDefaultToolkit().getScreenSize().width / 2) -
                (getWidth() / 2)),
                ((Toolkit.getDefaultToolkit().getScreenSize().height / 2) -
                        (getHeight() / 2)));

        //set look and feel
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
        ImageIcon appIcon = StringUtils.createImageIcon("/images/appIcon2.gif");
        this.setIconImage(appIcon.getImage());
        //set the menu bar
        //this.setJMenuBar(NameGeneratorMenuBar.getMenu(thisPanel));
        //populate the content pane
        this.setContentPane(thisPanel.getPnl_MainPanel());

    }

    /**
     * Constructor for an edit frame pre-populated with values from an xml file
     *
     * @param title
     * @param id
     * @throws HeadlessException
     */
    public NPCEdit(String title, String id) throws HeadlessException {
        super(title);
        //setResizable(false);
        thisPanel = new NPCEditBinding(id);
        setLocation(((Toolkit.getDefaultToolkit().getScreenSize().width / 2) -
                (getWidth() / 2)),
                ((Toolkit.getDefaultToolkit().getScreenSize().height / 2) -
                        (getHeight() / 2)));

        //set look and feel
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
        ImageIcon appIcon = StringUtils.createImageIcon("/images/appIcon2.gif");
        this.setIconImage(appIcon.getImage());
        //set the menu bar
        //this.setJMenuBar(NameGeneratorMenuBar.getMenu(thisPanel));
        //populate the content pane
        this.setContentPane(thisPanel.getPnl_MainPanel());

    }


    public static void main(String[] args) {
        TimelineGenerator window = new TimelineGenerator("NPC Editor");
        window.pack();
        window.setVisible(true);
    }
}
